package javabasics.concurrent.futrue;

import java.util.concurrent.*;

/**
 * @Author suxiaoxiao
 * @Date 2019/6/16 0:14
 * @Version 1.0
 */
public class futrueTest {

    public static void main(String[] args) throws InterruptedException, ExecutionException {
        // 构造 FutureTask
        FutureTask<String> futureTask = new FutureTask<String>(new RealData("a"));
        // 创建指定长度的 线程池
        ExecutorService executorService = Executors.newFixedThreadPool(1);
        executorService.submit(futureTask);
        System.out.println("请求完毕！");
        Thread.sleep(100);
        System.out.println("数据 = " + futureTask.get());
        System.out.println("会执行吗？");
    }

}
